package io.cloud.tec.project.model;

import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.List;

@Data
@EqualsAndHashCode(callSuper = true)
public class PageResult<T> extends Result<T> {
    private Integer pageNo;
    private Integer pageSize;
    private Integer totalCount;
    private List<T> pageResult;

    public PageResult() {
        super();
    }


    public static <T> PageResult<T> page(List<T> pageData) {
        PageResult<T> page = new PageResult<>();
        page.pageResult = pageData;
        return page;
    }

    public static <T> PageResult<T> page(Integer pageNo, Integer pageSize, Long totalCount, List<T> pageData) {
        PageResult<T> page = new PageResult<>();
        page.pageNo = pageNo;
        page.pageSize = pageSize;
        page.totalCount = totalCount.intValue();
        page.pageResult = pageData;
        return page;
    }
}
